#ifndef _aky_delay_H
#define _aky_delay_H
#include "aky_define.h"

#define AKY_TICK_INTERVAL (10ul) //ms

//根据设定的目标时间周期置零置一
#define TIME_10MS aky_get_target_time_stat(10)
#define TIME_20MS aky_get_target_time_stat(20)
#define TIME_40MS aky_get_target_time_stat(40)
#define TIME_80MS aky_get_target_time_stat(80)
#define TIME_160MS aky_get_target_time_stat(160)
#define TIME_320MS aky_get_target_time_stat(320)
#define TIME_640MS aky_get_target_time_stat(640)
#define TIME_1S aky_get_target_time_stat(1000)
#define TIME_2S aky_get_target_time_stat(2000)


#define OFF_TIME_TICK_10MS_COUNT (10 / AKY_TICK_INTERVAL)
#define OFF_TIME_TICK_100MS_COUNT (OFF_TIME_TICK_10MS_COUNT * 10)
#define OFF_TIME_TICK_1S_COUNT (OFF_TIME_TICK_100MS_COUNT * 10)

void aky_delay_init(void);
void aky_delay_tick_incre_pro(void);
void aky_tick_delay_ms(uint32_t ms);
void aky_soft_delay_ms(uint32_t ms);
uint8_t aky_get_target_time_stat(uint32_t target_tick);
void off_time_tick_clr(void);
uint32_t get_cur_off_time_tick(void);
uint8_t aky_off_time_trig(uint16_t target_off_time);
void delay(uint32_t delay);

#endif // 